import _ from '@/utils/commonFn';
import * as types from '../action-types';
import cache from '@/utils/cache';

const initialState = {
  userInfo: cache.getCache('userInfo') || {}
};

const baseReducer = (state = initialState, action) => {
  state = _.clone(true, state);

  switch (action.type) {
    case types.BASE_SET_USERINFO:
      state.userInfo = action.payload;
      break;
    default:
  }

  return state;
};

export default baseReducer;
